#include<stdio.h>


char* my_strncpy(char* arr2,const char* arr1, int k)
{
	int i = 0;
	char* ret = arr2;
	for (i = 0; arr1[i] != '\0' && i < k; i++)
	{
		arr2[i] = arr1[i];
	}
	arr2[i] = '\0';
	return ret;
}
int main()
{
	char arr1[] = "abcdef";
	char arr2[20] = { 0 };
	char* ret = my_strncpy(arr2, arr1, 3);
	printf("%s", ret);
	return 0;
}